package com.zlp.mall.portal.controller;


import com.zlp.mall.common.api.R;
import com.zlp.mall.portal.modules.pms.dto.resp.HomeGoodsSaleResp;
import com.zlp.mall.portal.modules.pms.dto.resp.HomeMenuBannerResp;
import com.zlp.mall.portal.modules.pms.service.HomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页模块 前端控制器
 * </p>
 *
 * @author ZouLiPing
 * @since 2021-10-13
 */
@RestController
@RequestMapping("/home")
@RequiredArgsConstructor
@Api(value = "HomeController",tags = "首页模块")
public class HomeController {


    private final HomeService homeService;

    @GetMapping("/getMenusBanner")
    @ApiOperation(value = "获取首页商品分类和 Banner 信息")
    public R<HomeMenuBannerResp> getMenusBanner(){

        HomeMenuBannerResp homeMenuBannerResps = homeService.getMenusBanner();
        return R.success(homeMenuBannerResps);
    }

    @GetMapping("/goodsSale")
    @ApiOperation(value = "获取分类推荐和分类推荐对应的推进商品")
    public R<List<HomeGoodsSaleResp>> goodsSale(){
        List<HomeGoodsSaleResp> homeGoodsSaleResps = homeService.goodsSale();
        return R.success(homeGoodsSaleResps);
    }



}

